﻿//双击事件
function CustomDbClick() {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
//    var myDate = new Date();
//    var year = myDate.getYear();
//    var month = myDate.getMonth() + 1;
//    var date = myDate.getDate();
//    if (month < 10) {
//        month = "0" + month;
//    }
//    if (date < 10) {
//        date = "0" + date;
//    }
//    var day = year + "-" + month + "-" + date;
//    var sday = record.getData("QStartTime").replace(" ", "");
//    var eday = record.getData("QEndTime").replace(" ", "");
//    if (day < sday) {
//        alert("调研还未开始");
//        return;
//    }
//    if (day > eday) {
//        alert("调研已结束");
//        return;
//    }
    if (record.getData("IsFinish") == 'Y') {
        alert("您的问卷已经提交，有疑问请联系管理员");
        return;
    }

    document.getElementById("EditUIWindow3").src = "../TR/QuestionnaireOnline.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
    YAHOO.example.container.dialog5.show();
}
//预览
var fnYulan = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    document.getElementById("EditUIWindow3").src = "../TR/QSView.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&QID=" + record.getData(const_entityID);
    YAHOO.example.container.dialog5.show();
}

//在线考试
var fnOnline = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
//    var myDate = new Date();
//    var year = myDate.getYear();
//    var month = myDate.getMonth() + 1;
//    var date = myDate.getDate();
//    if (month < 10) {
//        month = "0" + month;
//    }
//    if (date < 10) {
//        date = "0" + date;
//    }
//    var day = year + "-" + month + "-" + date;
//    var sday = record.getData("QStartTime").replace(" ", "");  
//    var eday = record.getData("QEndTime").replace(" ", "");
//    if (day < sday) {
//        alert("调研还未开始");
//        return;
//    }
//    if (day > eday) {
//        alert("调研已结束");
//        return;
//    }
    if (record.getData("IsFinish") == 'Y') {
        alert("您的问卷已经提交，有疑问请联系管理员");
        return;
    }

    document.getElementById("EditUIWindow3").src = "../TR/QuestionnaireOnline.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
    YAHOO.example.container.dialog5.show();
}
//关闭弹出窗体
function closeD5() {
    YAHOO.example.container.dialog5.cancel();
    LoadData();
}